Elastic Stack 5 : Elasticsearch Cluster
2017/04/12 |
Configure Elasticsearch Cluster.
This example shows to configure Elasticsearch Cluster with 3 Nodes and configure each Node is Master Eligible Node and Data Node (default).
Each node serves one or more purpose, refer to details below.
⇒ https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-node.html |
|
[1] | |
[2] | Change settings on all Nodes like follows. |
[root@node01 ~]#
vi /etc/elasticsearch/elasticsearch.yml # line 17: uncomment and change (any name you like) cluster.name: elastic-cluster
# line 23: uncomment and change (set Hostanme for node name) node.name: ${HOSTNAME}
# line 55: uncomment and change (listen all) network.host: 0.0.0.0
# line 68: uncomment and change (specify all Nodes) discovery.zen.ping.unicast.hosts: ["10.0.0.51", "10.0.0.52", "10.0.0.53"]
# line 72: uncomment and change specify [(number of Master Eligible Node) / 2 + 1] discovery.zen.minimum_master_nodes: 3
systemctl restart elasticsearch |
[3] | If Firewalld is running, allow service ports. |
[root@node01 ~]# firewall-cmd --add-port={9200/tcp,9300/tcp} --permanent success [root@node01 ~]# firewall-cmd --reload success |
[4] | Make sure Cluster status. If the status is green, it's OK. |
[root@node01 ~]# curl http://10.0.0.51:9200/_cluster/health?pretty { "cluster_name" : "elastic-cluster", "status" : "green", "timed_out" : false, "number_of_nodes" : 3, "number_of_data_nodes" : 3, "active_primary_shards" : 0, "active_shards" : 0, "relocating_shards" : 0, "initializing_shards" : 0, "unassigned_shards" : 0, "delayed_unassigned_shards" : 0, "number_of_pending_tasks" : 0, "number_of_in_flight_fetch" : 0, "task_max_waiting_in_queue_millis" : 0, "active_shards_percent_as_number" : 100.0 } |